<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	
	<!-- jQuery.css -->
	<link href="<?=$mvc->parse('{base_url}')?>css/custom-theme/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" media="all" />
	
	<!-- jQuery.js -->
	<script src="<?=$mvc->parse('{base_url}')?>js/jquery-1.6.2.min.js" type="text/javascript"></script>
	<script src="<?=$mvc->parse('{base_url}')?>js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
	<script src="<?=$mvc->parse('{base_url}')?>js/jquery.cookie.js" type="text/javascript"></script>
	<script src="<?=$mvc->parse('{base_url}')?>js/jquery.ui.datepicker-ru.js" type="text/javascript"></script>
	<script src="<?=$mvc->parse('{base_url}')?>js/ui.dropdownchecklist.js" type="text/javascript"></script>
	<script src="<?=$mvc->parse('{base_url}')?>js/ui.dropdownchecklist.js" type="text/javascript"></script>

	<!-- dropdown menu -->
	<script src="<?=$mvc->theme->make_url('dropdown/drop_dow.js');?>" type="text/javascript"></script>
	<link href="<?=$mvc->theme->make_url('dropdown/mmstyle.css');?>" rel="stylesheet" type="text/css" media="all" />

	<link href="<?=$mvc->theme->make_url('style.css');?>" rel="stylesheet" type="text/css" media="all" />
	<link href="<?=$mvc->base_url?>css/jquery.toChecklist.min.css" rel="stylesheet" type="text/css" media="all" />
	
	<base href="<?=$mvc->config['base_url']?>" />

	<style>
		.ui-widget {font-size:inherit; font-family:inherit}
	</style>	
</head>
<body>
	<table align="center">
		<tr>
			<td>

	<!-- start header -->
	<div id="header">
		<div id="logo">
			<h1>Грузоперевозки</h1>
		</div>
		<div id="search">
			<? if ($mvc->user->logged()) {?>
			<form action="<?=$mvc->parse('{base_url}default/logout');?>" method="post">
				<fieldset>
					<input id="x" type="submit" value="<?=$mvc->tr('Log out')?>"/>
					<div style="float:right"><?=$mvc->user->name?>&nbsp;&nbsp;</div>
					
					<!-- <input type="submit" value="<?=$mvc->tr('Log out')?>"/> -->
				</fieldset>
			</form>
			<? } else {?>
			<form action="<?=$mvc->parse('{base_url}default/login');?>" method="post">
				<fieldset>
					<input id="x" type="submit" value="<?=$mvc->tr('Log in')?>"/>					
					<input type="password" name="password" style="width:100px; float:right" />
					<input type="text" name="username" style="width:100px; float:right" />					
				</fieldset>
			</form>
			<? } ?>	
		</div>
	</div>
	<!-- end header -->

	<!-- start menu -->
	<div id="menu">
		<?
			$sql = 'SELECT cars.number, cars.name, strahovki.date_finish as date_ FROM strahovki, cars WHERE (strahovki.cars_id=cars.id) AND (TO_DAYS(date_finish) - TO_DAYS(NOW()) < 8) AND remember=1';
			foreach($mvc->db->get_data($sql) as $row)
			{
				echo '<div style="background:fdd; border:1px solid #eee; padding:2px">';
				echo 'Заканчивается страховка: '.$row['name'].'('.$row['number'].') '.$row['date_'].'';
				echo '</div>';
			}
	
			$sql = 'SELECT cars.name, cars.number, tehosmotr.date_next as date_ FROM tehosmotr, cars WHERE tehosmotr.cars_id=cars.id AND (TO_DAYS(date_next) - TO_DAYS(NOW())) < 15';
			foreach($mvc->db->get_data($sql) as $row)
			{
				echo '<div style="background:fdd; border:1px solid #eee; padding:2px">';
				echo 'Заканчивается техосмотр: '.$row['name'].'('.$row['number'].') '.$row['date_'].'';
				echo '</div>';
			}
			
			/*
			$sql = 'SELECT * from orders WHERE 1';// cars.name, cars.number, tehosmotr.date_next as date_ FROM tehosmotr, cars WHERE tehosmotr.cars_id=cars.id AND TO_DAYS(date_next) - TO_DAYS(NOW()) < 100';
			foreach($mvc->db->get_data($sql) as $row)
			{
				echo '<div style="background:fdd; border:1px solid #eee; padding:2px">';
							print_r($row);//echo 'Заканчивается техосмотр: '.$row['name'].'('.$row['number'].') '.$row['date_'].'';
				echo '</div>';
			}
			*/	
		?>
		
		<? include('menu.php'); ?>
	</div>
	<!-- end menu -->

	<!-- start page -->
	<div id="page">
		<!-- start content -->
		<div id="content">	
		